package com.study.service;

import com.study.domain.Product;
import com.study.service.fallback.ProductServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author MI
 * @version 1.0
 * @date 2020/10/18 18:15
 */
//value用于指定nacos下面那个服务
@FeignClient(value = "service-product",
        // fallback = ProductServiceFallback.class
        fallbackFactory = ProductServiceFallbackFactory.class
)
public interface ProductService {
    //FeignClient + RequestMapping 就是一个完整的请求路径
    @RequestMapping("/product/{pid}")
    Product findByPid(@PathVariable("pid") Integer pid);
}
